package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.LkgVideo;

/**
 * 
 * @author 
 *
 */
@DAO
public interface LkgVideoDAO{
	
	@SQL("SELECT * FROM LkgVideo WHERE 1=1 #if(:t.name!=''){ AND name like '%##(:t.name)%' } ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<LkgVideo> query(@SQLParam("t") LkgVideo lkgVideo);
	
	@SQL("SELECT count(*) FROM LkgVideo WHERE 1=1 #if(:t.name!=''){ AND name like '%##(:t.name)%' } ")
    int querysize(@SQLParam("t") LkgVideo lkgVideo);
    
    @SQL("SELECT * FROM LkgVideo WHERE id=:1")
    LkgVideo queryById(int id);
    
    @SQL("INSERT INTO LkgVideo (name,path,updateAt,updateUser,createAt,createUser) VALUES (:t.name,:t.path,now(),:t.updateUser,now(),:t.createUser)")
    void create(@SQLParam("t") LkgVideo lkgVideo);
	
	@SQL("UPDATE LkgVideo SET name=:t.name,path=:t.path,updateAt=now(),updateUser=:t.updateUser WHERE id=:t.id")
    void update(@SQLParam("t") LkgVideo lkgVideo);
    
    @SQL("DELETE FROM LkgVideo WHERE id=:1")
    void deleteById(int id);
}